﻿package com.bizmlib.lang
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	
	
	public class LocaleEvent extends Event
	{
		public static const LOAD_DONE:String = "loadDone";
		public static const LOAD_PROGRESS:String = "loadProgress";
		
		// probably this one should be splitted
		// at the moment dispatched everytime either a language content or a default language is changed
		public static const CHANGE:String = "change";
		
		public var data:*;
		public var errorMessage:String;
		
		
		public function LocaleEvent(type:String, data:* = null, errorMessage:String = undefined)
		{
			super(type, false, false);
			this.data = data;
			this.errorMessage = errorMessage || "";
		}
		
		
		public function get success():Boolean
		{
			return Boolean(data);
		}
		
		
		override public function toString():String
		{
			return formatToString("LocaleEvent", "type", "errorMessage", "bubbles", "cancelable", "success");
		}
	}
}